<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="按钮" onclick="fn1()">
<script>
    function fn1(){
        for (let i = 0; i < 10; i++) {
            alert(i)
        }
    }
    //1、无参返回值
    function f1(){
        alert("f1")
    }
    //f1();//调用

    //2.有参无返回值
    function f2(name,age){
        alert(name+": "+age);
    }
    //f2("张飞",18);

    //3.无参有返回值
    function f3(){
        return "我是返回值";
    }
    let info = f3();
    //alert(info);

    //4.有参有返回值
    function f4(x,y){
        return x*y;
    }
    let result = f4(3,4);
    // alert(result);

    //5.第二种申明方法的格式
    let f5 = function (name,age){
        alert(name+": "+age);
    }
    //f5("张三",50);

    //6.第三种申明方法的格式
    let f6 = new Function("name","age","alert(name+':'+age)");
    // f6("赵云",20);



</script>
<div>该吃饭了</div>
<input type="text" id="i1">
<input type="button" value="按钮" onclick="f()">
<script>
    function  f(){
        //得到文本框的和DIV的对象
        let i = document.querySelector("#i1");
        let d = document.querySelector("div");
        //把文本框的值给到div
        d.innerText = i.value;
    }
</script>
</body>

</html>